﻿package core.ui.dialogs
{
    import core.enum.*;
    import core.event.*;
    import core.image.*;
    import core.ui.controls.*;

    public class KaleidoscopeDialog extends BitmapOperationDialogBase
    {
        var f:Filter;
        var s:Slidebar;
        var h:Slidebar;
        var v:Slidebar;

        public function KaleidoscopeDialog(param1:Tuyitu)
        {
            super(param1, "rm_kaleidoscope", 240, 220, Action.KaleidoscopeFilter);
            this.f = new Filter();
            this.s = new Slidebar("rm_size", 0, 100, 200, 50);
            this.s.addEventListener(SliderEvent.CHANGE, this.Change, false, 1, true);
            this.s.x = 20;
            this.s.y = 35;
            addChild(this.s);
            this.h = new Slidebar("rm_horizontal", 0, 100, 200, 50);
            this.h.addEventListener(SliderEvent.CHANGE, this.Change, false, 1, true);
            this.h.x = 20;
            this.h.y = 80;
            addChild(this.h);
            this.v = new Slidebar("rm_vertical", 0, 100, 200, 50);
            this.v.addEventListener(SliderEvent.CHANGE, this.Change, false, 1, true);
            this.v.x = 20;
            this.v.y = 125;
            addChild(this.v);
            return;
        }// end function

        override public function Change(... args) : void
        {
            if (!locked)
            {
                bm.copyPixels(bc, bm.rect, bm.rect.topLeft);
                this.f.Kaleidoscope(bm, bc, this.h.value, this.v.value, this.s.value, selection, offset);
            }
            return;
        }// end function

    }
}
